package control;
import java.util.List;

import dao.AccountDAO;
import entity.Account;
import flex.messaging.FlexContext;
import flex.messaging.io.ArrayList;


public class AccountControl {
	public Account getAccountInfo(String username, int whichAccount){
		//get userid from session
		//I found that in this environment I can't return a list of certain type to the front end...but at last I can transfer single object back...
		System.out.println("getAccountInfo");
		AccountDAO accountDao = new AccountDAO();
		//String userid = (String) FlexContext.getFlexSession().getAttribute(username);
		return accountDao.queryAccounts(username).get(whichAccount);//ÿ�η���һ��
	}
	
	public int getHowManyAccounts(String username){
		System.out.println("getHowManyAccounts");
		AccountDAO accountDao = new AccountDAO();
		//String userid = (String) FlexContext.getFlexSession().getAttribute(username);
		return accountDao.queryAccounts(username).size();
	}
}
